package com.dslcode.cloud.common.api.order;

import com.dslcode.cloud.common.dto.order.OrderCreateDTO;
import com.dslcode.cloud.common.dto.order.OrderDetailDTO;
import com.dslcode.cloud.common.dto.order.OrderPayDTO;
import com.dslcode.cloud.common.model.order.Order;
import com.dslcode.cloud.common.utils.AjaxResponse;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;

/**
 * Created by dongsilin on 2017/10/10.
 */
public interface OrderAPI {

    /**
     * url请求前缀
     */
    String REQUEST_PREFIX = "order";

    @GetMapping(REQUEST_PREFIX)
    AjaxResponse<PageInfo<OrderPayDTO>> list(@RequestParam(name = "pageNum", defaultValue = "1") int pageNum, @RequestParam(name = "pageSize", defaultValue = "10") int pageSize);

    @GetMapping(REQUEST_PREFIX + "/{id}")
    AjaxResponse<OrderDetailDTO> detail(@PathVariable(name = "id") Long id);

    @PostMapping(REQUEST_PREFIX)
    AjaxResponse<Order> create(@RequestBody OrderCreateDTO orderCreate, @RequestParam(name = "userId", defaultValue = "1") Long userId);

}
